
package lab2;

import java.io.IOException;

public class exe4 {
	public static boolean armstrong(int num){
		int sum = 0;
		int numm = num;
		int length = (int)(Math.log10(num)+1);
		while(num>0){
			int index = (num%10);
			sum += (int) Math.pow(index, length);
			num/=10;
		}
		return (sum == numm) ? true : false;

	}
	public static void main(String[] args) throws IOException {
		//exercise 4
		System.out.println("exerise 4: ");
		for(int i=0;i<1000;i++){
			if(exe4.armstrong(i)){
				System.out.println(i);
			}
		}
		//exercise 5
		System.out.println("exerise 5: ");
		System.out.println("para 1: ");
		new ext5("p1.txt");
		System.out.println("para 2: ");
		new ext5("p2.txt");
	}

}
